package bean;

import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

public class CustomUser implements UserDetails{

	private static final long serialVersionUID = 1L;
	
	private Long id;  
    private String username;  
    private String password;  
    private boolean enabled;  
    private Collection<? extends GrantedAuthority> authorities;  
    
    public CustomUser(Long id, String username, String password, boolean enabled) {  
        super();  
        this.id = id;  
        this.username = username;  
        this.password = password;  
        this.enabled = enabled;  
    }  
    
    public CustomUser(Long id, String username, String password, boolean enabled, Collection<? extends GrantedAuthority> authorities) {  
        super();  
        this.id = id;  
        this.username = username;  
        this.password = password;  
        this.enabled = enabled;  
        this.authorities = authorities;
    }  
	public Collection<? extends GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		return authorities;
	}

	public Long getId() {
		// TODO Auto-generated method stub
		return id;
	}

	public String getPassword() {
		// TODO Auto-generated method stub
		return password;
	}

	public String getUsername() {
		// TODO Auto-generated method stub
		return username;
	}

	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return true;
	}

	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return enabled;
	}
	 @Override  
    public String toString() {  
        return "MyUserDetails [id=" + id + ", username=" + username  
                + ", password=" + password + ", enabled=" + enabled  
                + ", authorities=" + authorities + "]";  
    }  
	  
}
